<%--
  Created by IntelliJ IDEA.
  User: 31921
  Date: 2024/12/14
  Time: 22:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<html>
    <head>
        <title>学生管理系统 - 注册</title>
        <style>
            body {
                font-family: Arial, sans-serif;
                background-color: #f4f4f4;
                margin: 0;
                padding: 0;
            }
            .container {
                max-width: 400px;
                margin: 50px auto;
                padding: 20px;
                background-color: white;
                box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
                border-radius: 8px;
            }
            h2 {
                text-align: center;
                margin-bottom: 20px;
            }
            .input-field {
                width: 100%;
                padding: 10px;
                margin: 10px 0;
                border: 1px solid #ccc;
                border-radius: 4px;
            }
            .btn {
                width: 100%;
                padding: 10px;
                background-color: #4CAF50;
                color: white;
                border: none;
                border-radius: 4px;
                cursor: pointer;
            }
            .btn:hover {
                background-color: #45a049;
            }
            .link {
                text-align: center;
                margin-top: 10px;
            }
            .error {
                color: red;
                font-size: 12px;
                text-align: center;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <h2>注册</h2>
            <!-- 注册表单 -->
            <form action="register" method="post">
                <input class="input-field" type="text" name="username" placeholder="用户名" required />
                <input class="input-field" type="password" name="password" placeholder="密码" required />
                <input class="input-field" type="password" name="confirmPassword" placeholder="确认密码" required />
                <input class="input-field" type="email" name="email" placeholder="邮箱" required />
                <button type="submit" class="btn">注册</button>
            </form>

            <!-- 错误信息显示 -->
            <%
                String registerErrorMessage = (String) request.getAttribute("registerErrorMessage");
                if (registerErrorMessage != null && !registerErrorMessage.isEmpty()) {
            %>
            <div class="error"><%= registerErrorMessage %></div>
            <%
                }
            %>

            <div class="link">
                已有账号? <a href="login.jsp">点击这里登录</a>
            </div>
        </div>
    </body>
</html>

